<?php
    include "link.php";

    echo select();
    function select(){
        global $link;
        $sql="SELECT * FROM goods";
        $q=mysqli_query($link,$sql);
       
        if($q){
            $bigArr=array();
            while($arr=mysqli_fetch_assoc($q)){
                array_push($bigArr,$arr);
            }
            // 返回数据
            $arr=array("code"=>2,"msg"=>$bigArr);
            return json_encode($arr);
        }else{
            $arr=array("code"=>1,"msg"=>"查询错误，请检查数据库");
            return json_encode($arr);
        }
    }
    


?>